package com.itheima.zuoye.zy4;

import java.util.Comparator;
import java.util.Set;
import java.util.TreeSet;


public class Demo4 {
    public static void main(String[] args) {
        Set<Person> set = new TreeSet<>(new Comparator<Person>() {
            @Override
            public int compare(Person o1, Person o2) {
                return  o1.getIdCard()-o2.getIdCard() ;
            }
        });
        set.add(new Person(154, "zhaoliu"));
        set.add(new Person(101, "zhangsan"));
        set.add(new Person(101, "zhangsan"));
        set.add(new Person(133, "wangwu"));
        set.add(new Person(115, "zhangsan"));
        set.add(new Person(115, "zhangsan"));
        set.add(new Person(112, "lisi"));
        System.out.println(set);
    }
}